#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct BinaryTreeNode
{
	char data;
	struct BinaryTreeNode* left;
	struct BinaryTreeNode* right;
}BTNode;

BTNode* TreeCreate(char* arr,int *i)
{
	if (arr[*i] == '#')
	{
		(*i)++;
		return NULL;
	}
	BTNode* root = (BTNode*)malloc(sizeof(BTNode));
	root->data = arr[(*i)++];
	root->left = TreeCreate(arr, i);
	root->right = TreeCreate(arr, i);
	return root;
	
}
void  TreeInorede(BTNode* tree)
{
	if (tree == NULL)
	{
		//printf(" ");
		return;
	}
	TreeInorede(tree->left);
	printf("%c ", tree->data);
	TreeInorede(tree->right);
}
int main()
{
	char arr[100] = {0};
	scanf("%s", arr);
	int i = 0;
	BTNode *tree = TreeCreate(arr,&i);
	TreeInorede(tree);
	return 0;
}